<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>背景图片的尺寸</title>
		
		<style>
			*{
				margin: 0;
				padding: 0;
			}
			.center{
				width: 900px;
				height: 300px;
				margin: 0 auto;
				background-color: rgba(0, 0, 255, 0.4);
			}
			.bg1 .pic{
				height: 500px;
				border: 2px solid red;
				background-image: url(img/bg.png) ;
				background-size: 100% auto;
				background-repeat: no-repeat;
				background-size: auto 100%;
				background-size: cover; /* 铺满整个屏幕 多余部分裁掉  */
				/*  至少有一张完整的图呈现出来，一定会有多余的空间  */
				/* background-size: contain; */
			}
			.bg1 .shucai{
				height: 500px;
				border: 2px solid green;
				background-image: url(img/carousel-1.jpg);
				background-size: contain;
				background-size: 100% 100%;
				/* background-size: cover; */
			}
			
			
			
		</style>
		
	</head>
	<body>
		
		
		<div class="bg1">
			<div class="center">
				
				<div class="pic"></div>
				<div class="shucai">
					
				</div>	
				
			</div>
		</div>
		
		
	</body>
</html>